package com.yang.action;

import com.yang.entity.Product;
import com.yang.service.ProductService;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.yang.util.RespEntity;
import com.yang.util.RespUtil;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

@WebServlet("/ProductQueryById")
public class ProductQueryByIdAction extends HttpServlet {
    ProductService productService = new ProductService();
    //详情
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        String id = req.getParameter("id");
        RespEntity respEntity = productService.queryProductById(Integer.parseInt(id));
        RespUtil.sendJSON(resp, respEntity);
    }
}

